package com.punai.config.constants;

public class PnConfigConstants {

    public enum INVENTORY_TYPE{
        GB("G","国标清单库"),
        QB("Q","企业标准清单库"),
        FB("F","非标清单库");

        private String code;
        private String desc;

        INVENTORY_TYPE(String code,String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 章节类型
     */
    public static final String CHAPTER_ZY_TYPE = "Z";
    public static final String CHAPTER_FBGC_TYPE = "F";



    public enum EDITSTATE {
        SAVESTATE(1, "保存"), UPDATESTATE(2, "更新");
        /**
         * 说明： 编辑类型
         */
        private Integer type;
        /**
         * 说明： 类型名称
         */
        private String typeName;

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }

        public String getTypeName() {
            return typeName;
        }

        public void setTypeName(String typeName) {
            this.typeName = typeName;
        }

        private EDITSTATE(Integer type, String typeName) {
            this.type = type;
            this.typeName = typeName;
        }

        public  EDITSTATE getEnum(String type) {
            return null;
        }
    }


    /**
     * 说明：实体持久化的版本号
     */
    public static final Integer ENTITY_VERSION = 1;

    public enum CODE_TYPE {
        CNT_CODE("CNT", 4, ""),
        PRJ_CODE("PRJ", 6, ""),
        ENG_CODE("ENG", 4, ""),
        ELE_CODE("ELE", 4, "tab_config_feature_element"),
        IND_CODE("II",4, "tab_config_indicator_item"),
        COS_CODE("CI", 4, ""),
        INS_CODE("ICS", 4, ""),
        CSS_CODE("CCS", 4, ""),
        INFO_CODE("INFO",4, ""), //2019/01/19ADD
        FEA_CODE("FEA",4, ""),//2019/01/19 ADD ;
        CL_CODE("CL",6, ""),//2021年3月3日11:39:48
        FL_CODE("FL",4, ""),//2021年3月3日11:39:48
        QD_CODE("QD",9, ""),//2021年3月3日11:39:48
        YT_CODE("YT",4, "TAB_CONFIG_FORMATCATEGORY");//2021年3月3日11:40:06

        private Integer length;
        private String prefix;
        private String sqliteTableName;

        public Integer getLength() {
            return length;
        }

        public void setLength(Integer length) {
            this.length = length;
        }

        public String getPrefix() {
            return prefix;
        }

        public void setPrefix(String prefix) {
            this.prefix = prefix;
        }

        public String getSqliteTableName() {
            return sqliteTableName;
        }

        public void setSqliteTableName(String sqliteTableName) {
            this.sqliteTableName = sqliteTableName;
        }

        private CODE_TYPE(String prefix, Integer length, String sqliteTableName) {
            this.prefix = prefix;
            this.length = length;
            this.sqliteTableName = sqliteTableName;
        }

        public static CODE_TYPE getEnum(String prefix) {
            if (prefix == null)
                return null;
            for (CODE_TYPE v : values())
                if (prefix.compareTo(v.getPrefix()) == 0)
                    return v;
            return null;
        }

        @Override
        public String toString() {
            return this.name() + ":" + this.prefix;
        }
    }

    public static enum TEMPLATE_TYPE {
        INDICATOR_TEMPLATE_TYPE("0", "IT"), COST_TEMPLATE_TYPE("1", "IC"), COSTS_TEMPLATE_TYPE("2",
                "CT"), COSTS_INDICATOR_TEMPLATE_TYPE("7", "CIT");
        private String type;
        private String prefix;

        private TEMPLATE_TYPE(String type, String prefix) {
            this.type = type;
            this.prefix = prefix;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getPrefix() {
            return prefix;
        }

        public void setPrefix(String prefix) {
            this.prefix = prefix;
        }

        public static String getPrefixByType(String type) {
            for (TEMPLATE_TYPE value : TEMPLATE_TYPE.values()) {
                if (value.getType().equals(type)) {
                    return value.getPrefix();
                }
            }
            return null;
        }
    }


}
